#include<stdio.h>

void main(){

float pi = 0,i = 0,flag = 1;

for(i=1;1/i>=0.0001;i = i + 2)
{
   pi = pi + 1 / i * flag;
   flag = -flag;
}
pi = pi * 4;
printf("pi = %f\n",pi);
}